The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
Changes 03
META.json 3636
META.yml 3636
Makefile.PL 33
README 11
dist.ini 22
lib/DBIx/Class/KiokuDB/EntryProxy.pm 11
lib/DBIx/Class/KiokuDB.pm 11
lib/DBIx/Class/Schema/KiokuDB.pm 22
lib/KiokuDB/Backend/DBI/Schema.pm 11
lib/KiokuDB/Backend/DBI.pm 1534
lib/KiokuDB/TypeMap/Entry/DBIC/ResultSet.pm 11
lib/KiokuDB/TypeMap/Entry/DBIC/ResultSourceHandle.pm 11
lib/KiokuDB/TypeMap/Entry/DBIC/Row.pm 11
lib/KiokuDB/TypeMap/Entry/DBIC/Schema.pm 11
15 files changed (This is a version diff) 102124
@@ -1,3 +1,6 @@
+1.16
+    - Adds support for Set GIN queries
+
 1.15
     - Constructing a KiokuDB directory handle is no longer mandatory, you can
       get it from the DBIC schema (domm, nothingmuch)
@@ -4,7 +4,7 @@
       "Yuval Kogman"
    ],
    "dynamic_config" : "1",
-   "generated_by" : "Dist::Zilla version 4.101612, CPAN::Meta::Converter version 2.101610",
+   "generated_by" : "Dist::Zilla version 4.200000, CPAN::Meta::Converter version 2.102400",
    "license" : [
       "perl_5"
    ],
@@ -51,7 +51,7 @@
             "MooseX::Types::Moose" : 0,
             "SQL::Abstract" : 0,
             "Scalar::Util" : 0,
-            "Search::GIN" : 0,
+            "Search::GIN" : "0.07",
             "Search::GIN::Extract::Delegate" : 0,
             "Test::More" : "0.88",
             "Test::TempDir" : 0,
@@ -88,93 +88,93 @@
          "web" : "http://github.com/nothingmuch/kiokudb-backend-dbi"
       }
    },
-   "version" : "1.15",
+   "version" : "1.17",
    "x_Dist_Zilla" : {
       "plugins" : [
          {
             "class" : "Dist::Zilla::Plugin::GatherDir",
             "name" : "@Filter/@Basic/GatherDir",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::PruneCruft",
             "name" : "@Filter/@Basic/PruneCruft",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::ManifestSkip",
             "name" : "@Filter/@Basic/ManifestSkip",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaYAML",
             "name" : "@Filter/@Basic/MetaYAML",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::License",
             "name" : "@Filter/@Basic/License",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::Readme",
             "name" : "@Filter/@Basic/Readme",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExtraTests",
             "name" : "@Filter/@Basic/ExtraTests",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExecDir",
             "name" : "@Filter/@Basic/ExecDir",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::ShareDir",
             "name" : "@Filter/@Basic/ShareDir",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::Manifest",
             "name" : "@Filter/@Basic/Manifest",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::TestRelease",
             "name" : "@Filter/@Basic/TestRelease",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::ConfirmRelease",
             "name" : "@Filter/@Basic/ConfirmRelease",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::UploadToCPAN",
             "name" : "@Filter/@Basic/UploadToCPAN",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaConfig",
             "name" : "@Filter/MetaConfig",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaJSON",
             "name" : "@Filter/MetaJSON",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::PkgVersion",
             "name" : "@Filter/PkgVersion",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
             "name" : "@Filter/PodSyntaxTests",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::NoTabsTests",
@@ -184,22 +184,22 @@
          {
             "class" : "Dist::Zilla::Plugin::PodCoverageTests",
             "name" : "@Filter/PodCoverageTests",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaResources",
             "name" : "@Filter/MetaResources",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::Authority",
             "name" : "@Filter/Authority",
-            "version" : "1.000"
+            "version" : "1.001"
          },
          {
-            "class" : "Dist::Zilla::Plugin::AutoPrereq",
-            "name" : "@Filter/AutoPrereq",
-            "version" : "4.101612"
+            "class" : "Dist::Zilla::Plugin::AutoPrereqs",
+            "name" : "@Filter/AutoPrereqs",
+            "version" : "4.200000"
          },
          {
             "class" : "inc::DBICOptionalDeps",
@@ -209,13 +209,13 @@
          {
             "class" : "Dist::Zilla::Plugin::Prereq",
             "config" : {
-               "Dist::Zilla::Plugin::Prereq" : {
+               "Dist::Zilla::Plugin::Prereqs" : {
                   "phase" : "configure",
                   "type" : "requires"
                }
             },
             "name" : "ConfigureRequires",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::InjectMeta",
@@ -225,41 +225,41 @@
          {
             "class" : "Dist::Zilla::Plugin::Prereq",
             "config" : {
-               "Dist::Zilla::Plugin::Prereq" : {
+               "Dist::Zilla::Plugin::Prereqs" : {
                   "phase" : "runtime",
                   "type" : "requires"
                }
             },
             "name" : "Prereq",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":InstallModules",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":TestFiles",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ExecFiles",
-            "version" : "4.101612"
+            "version" : "4.200000"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ShareFiles",
-            "version" : "4.101612"
+            "version" : "4.200000"
          }
       ],
       "zilla" : {
-         "class" : "Dist::Zilla",
+         "class" : "Dist::Zilla::Dist::Builder",
          "config" : {
             "is_trial" : 0
          },
-         "version" : "4.101612"
+         "version" : "4.200000"
       }
    },
    "x_authority" : "cpan:NUFFIN"
@@ -16,7 +16,7 @@ configure_requires:
   DBIx::Class::Optional::Dependencies: 0
   ExtUtils::MakeMaker: 6.31
 dynamic_config: 1
-generated_by: 'Dist::Zilla version 4.101612, CPAN::Meta::Converter version 2.101610'
+generated_by: 'Dist::Zilla version 4.200000, CPAN::Meta::Converter version 2.102400'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -52,7 +52,7 @@ requires:
   MooseX::Types::Moose: 0
   SQL::Abstract: 0
   Scalar::Util: 0
-  Search::GIN: 0
+  Search::GIN: 0.07
   Search::GIN::Extract::Delegate: 0
   Test::More: 0.88
   Test::TempDir: 0
@@ -64,77 +64,77 @@ resources:
   bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=KiokuDB-Backend-DBI
   homepage: http://search.cpan.org/dist/KiokuDB-Backend-DBI
   repository: git://github.com/nothingmuch/kiokudb-backend-dbi.git
-version: 1.15
+version: 1.17
 x_Dist_Zilla:
   plugins:
     -
       class: Dist::Zilla::Plugin::GatherDir
       name: '@Filter/@Basic/GatherDir'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::PruneCruft
       name: '@Filter/@Basic/PruneCruft'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::ManifestSkip
       name: '@Filter/@Basic/ManifestSkip'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::MetaYAML
       name: '@Filter/@Basic/MetaYAML'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::License
       name: '@Filter/@Basic/License'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::Readme
       name: '@Filter/@Basic/Readme'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::ExtraTests
       name: '@Filter/@Basic/ExtraTests'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::ExecDir
       name: '@Filter/@Basic/ExecDir'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::ShareDir
       name: '@Filter/@Basic/ShareDir'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::Manifest
       name: '@Filter/@Basic/Manifest'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::TestRelease
       name: '@Filter/@Basic/TestRelease'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::ConfirmRelease
       name: '@Filter/@Basic/ConfirmRelease'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::UploadToCPAN
       name: '@Filter/@Basic/UploadToCPAN'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::MetaConfig
       name: '@Filter/MetaConfig'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::MetaJSON
       name: '@Filter/MetaJSON'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::PkgVersion
       name: '@Filter/PkgVersion'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::PodSyntaxTests
       name: '@Filter/PodSyntaxTests'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::NoTabsTests
       name: '@Filter/NoTabsTests'
@@ -142,19 +142,19 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::PodCoverageTests
       name: '@Filter/PodCoverageTests'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::MetaResources
       name: '@Filter/MetaResources'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::Authority
       name: '@Filter/Authority'
-      version: 1.000
+      version: 1.001
     -
-      class: Dist::Zilla::Plugin::AutoPrereq
-      name: '@Filter/AutoPrereq'
-      version: 4.101612
+      class: Dist::Zilla::Plugin::AutoPrereqs
+      name: '@Filter/AutoPrereqs'
+      version: 4.200000
     -
       class: inc::DBICOptionalDeps
       name: '=inc::DBICOptionalDeps'
@@ -162,11 +162,11 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::Prereq
       config:
-        Dist::Zilla::Plugin::Prereq:
+        Dist::Zilla::Plugin::Prereqs:
           phase: configure
           type: requires
       name: ConfigureRequires
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::InjectMeta
       name: InjectMeta
@@ -174,30 +174,30 @@ x_Dist_Zilla:
     -
       class: Dist::Zilla::Plugin::Prereq
       config:
-        Dist::Zilla::Plugin::Prereq:
+        Dist::Zilla::Plugin::Prereqs:
           phase: runtime
           type: requires
       name: Prereq
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':InstallModules'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':TestFiles'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ExecFiles'
-      version: 4.101612
+      version: 4.200000
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ShareFiles'
-      version: 4.101612
+      version: 4.200000
   zilla:
-    class: Dist::Zilla
+    class: Dist::Zilla::Dist::Builder
     config:
       is_trial: 0
-    version: 4.101612
+    version: 4.200000
 x_authority: cpan:NUFFIN
@@ -57,7 +57,7 @@ my %WriteMakefileArgs = (
     'MooseX::Types::Moose' => '0',
     'SQL::Abstract' => '0',
     'Scalar::Util' => '0',
-    'Search::GIN' => '0',
+    'Search::GIN' => '0.07',
     'Search::GIN::Extract::Delegate' => '0',
     'Test::More' => '0.88',
     'Test::TempDir' => '0',
@@ -66,7 +66,7 @@ my %WriteMakefileArgs = (
     'namespace::autoclean' => '0',
     'namespace::clean' => '0'
   },
-  'VERSION' => '1.15',
+  'VERSION' => '1.17',
   'test' => {
     'TESTS' => 't/*.t'
   }
@@ -75,7 +75,7 @@ my %WriteMakefileArgs = (
 
 unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
   my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
-  my $pp = $WriteMakefileArgs{PREREQ_PM}; 
+  my $pp = $WriteMakefileArgs{PREREQ_PM};
   for my $mod ( keys %$br ) {
     if ( exists $pp->{$mod} ) {
       $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; 
@@ -1,7 +1,7 @@
 
 
 This archive contains the distribution KiokuDB-Backend-DBI,
-version 1.15:
+version 1.17:
 
   L<DBI> backend for L<KiokuDB>
 
@@ -1,5 +1,5 @@
 name    = KiokuDB-Backend-DBI
-version = 1.15
+version = 1.17
 author  = Yuval Kogman
 license = Perl_5
 copyright_holder = Yuval Kogman, Infinity Interactive
@@ -37,4 +37,4 @@ Test::More = 0.88
 Test::TempDir = 0
 
 SQL::Abstract = 0
-Search::GIN = 0
+Search::GIN = 0.07
@@ -3,7 +3,7 @@ BEGIN {
   $DBIx::Class::KiokuDB::EntryProxy::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $DBIx::Class::KiokuDB::EntryProxy::VERSION = '1.15';
+  $DBIx::Class::KiokuDB::EntryProxy::VERSION = '1.17';
 }
 
 use strict;
@@ -3,7 +3,7 @@ BEGIN {
   $DBIx::Class::KiokuDB::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $DBIx::Class::KiokuDB::VERSION = '1.15';
+  $DBIx::Class::KiokuDB::VERSION = '1.17';
 }
 
 use strict;
@@ -3,7 +3,7 @@ BEGIN {
   $DBIx::Class::Schema::KiokuDB::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $DBIx::Class::Schema::KiokuDB::VERSION = '1.15';
+  $DBIx::Class::Schema::KiokuDB::VERSION = '1.17';
 }
 
 use strict;
@@ -14,7 +14,7 @@ use Carp qw(croak);
 use DBIx::Class::KiokuDB::EntryProxy;
 use DBIx::Class::ResultSource::Table;
 
-use Scalar::Util qw(weaken);
+use Scalar::Util qw(weaken refaddr);
 
 use namespace::clean;
 
@@ -5,7 +5,7 @@ BEGIN {
   $KiokuDB::Backend::DBI::Schema::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $KiokuDB::Backend::DBI::Schema::VERSION = '1.15';
+  $KiokuDB::Backend::DBI::Schema::VERSION = '1.17';
 }
 use Moose;
 
@@ -5,7 +5,7 @@ BEGIN {
   $KiokuDB::Backend::DBI::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $KiokuDB::Backend::DBI::VERSION = '1.15';
+  $KiokuDB::Backend::DBI::VERSION = '1.17';
 }
 use Moose;
 
@@ -887,24 +887,43 @@ sub search {
     );
 
     my %spec = $query->extract_values($self);
+    my @binds;
 
-    my @v = @{ $spec{values} };
+    my $inner_sql = $self->_search_gin_subquery(\%spec, \@binds);
+    return $self->_select_entry_stream("SELECT data FROM entries WHERE id IN ".$inner_sql,@binds);
+}
+
+sub _search_gin_subquery {
+    my ($self, $spec, $binds) = @_;
+
+    my @v = @{ $spec->{values} };
+    if ( $spec->{method} eq 'set' ) {
+        my $op = $spec->{operation};
+
+        die 'gin set query received bad operation'
+          unless $op =~ /^(UNION|INTERSECT|EXCEPT)$/i;
 
-    if ( $spec{method} eq 'all' and @v > 1) {
+        die 'gin set query missing subqueries'
+          unless ref $spec->{subqueries} eq 'ARRAY' &&
+            scalar @{ $spec->{subqueries} };
+
+        return "(".
+          (
+           join ' '.$op.' ',
+           map { $self->_search_gin_subquery($_, $binds) }
+           @{ $spec->{subqueries} }
+          ).")";
+
+    } elsif ( $spec->{method} eq 'all' and @v > 1) {
         # for some reason count(id) = ? doesn't work
-        return $self->_select_entry_stream("
-            SELECT data FROM entries WHERE id IN (
-                SELECT id FROM gin_index WHERE value IN (" . join(", ", ('?') x @v) . ") GROUP BY id HAVING COUNT(id) = " . scalar(@v) . "
-            )",
-            @v
-        );
+        push @$binds, @v;
+        return "( SELECT id FROM gin_index WHERE value IN ".
+          "(" . join(", ", ('?') x @v) . ")" .
+            "GROUP BY id HAVING COUNT(id) = " . scalar(@v). ")";
     } else {
-        return $self->_select_entry_stream("
-            SELECT data FROM entries WHERE id IN (
-                SELECT DISTINCT id FROM gin_index WHERE value IN (" . join(", ", ('?') x @v) . ")
-            )",
-            @v
-        );
+        push @$binds, @v;
+        return "( SELECT DISTINCT id FROM gin_index WHERE value IN ".
+          "(" . join(", ", ('?') x @v) . ") )";
     }
 }
 
@@ -3,7 +3,7 @@ BEGIN {
   $KiokuDB::TypeMap::Entry::DBIC::ResultSet::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $KiokuDB::TypeMap::Entry::DBIC::ResultSet::VERSION = '1.15';
+  $KiokuDB::TypeMap::Entry::DBIC::ResultSet::VERSION = '1.17';
 }
 use Moose;
 
@@ -3,7 +3,7 @@ BEGIN {
   $KiokuDB::TypeMap::Entry::DBIC::ResultSourceHandle::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $KiokuDB::TypeMap::Entry::DBIC::ResultSourceHandle::VERSION = '1.15';
+  $KiokuDB::TypeMap::Entry::DBIC::ResultSourceHandle::VERSION = '1.17';
 }
 use Moose;
 
@@ -3,7 +3,7 @@ BEGIN {
   $KiokuDB::TypeMap::Entry::DBIC::Row::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $KiokuDB::TypeMap::Entry::DBIC::Row::VERSION = '1.15';
+  $KiokuDB::TypeMap::Entry::DBIC::Row::VERSION = '1.17';
 }
 use Moose;
 
@@ -3,7 +3,7 @@ BEGIN {
   $KiokuDB::TypeMap::Entry::DBIC::Schema::AUTHORITY = 'cpan:NUFFIN';
 }
 BEGIN {
-  $KiokuDB::TypeMap::Entry::DBIC::Schema::VERSION = '1.15';
+  $KiokuDB::TypeMap::Entry::DBIC::Schema::VERSION = '1.17';
 }
 use Moose;